<?php $this->load->view('common/header');?>

<body class="padding_top">
<!-- head [[-->
<div class="head_box">
	<div class="bank_nav">
        <a href="<?php echo site_url('member/index');?>"><i class="ico"></i></a>
    </div>
    <div class="head_title">个人资料</div>
</div>
<!--]] head -->
<!-- info [[-->
<div class="site_form">
	<ul>
    	<li class="avatar_pic">
            <span class="title f_l">头像</span>
            <span class="content f_r">
                    <span class="avatar_pic_box">
                        <?php if(file_exists(FCPATH.'uploads/avatar/'.$user['user_id'].'/'.$user['user_id'].'_avatar_middle.jpg')){?>
                            <img src="<?php echo base_url('uploads/avatar/'.$user['user_id'].'/'.$user['user_id'].'_avatar_middle.jpg?t='.time());?>">
                        <?php }?>
                    </span>
                    <i class="ico"></i>
            </span>
        </li>
        <li>
        	<span class="title f_l">昵称</span>
            <span class="name"><input  id="user_uname" value="<?php echo $userinfo['user_name']; ?>"><i class="ico"></i></span>
        </li>
        <li>
        	<a href="<?php echo site_url('member/address/'.$userinfo['user_id']) ?>" class="posi_opacity">&nbsp;</a>
        	<span class="title f_l">收货地址</span>
            <span class="content f_r"><em><?php echo $userinfo['dress_city']; ?></em><i class="ico"></i></span>
        </li>
        <li>
            <a href="<?php echo site_url('member/bind_mobile') ?>" class="posi_opacity">&nbsp;</a>
            <span class="title f_l">手机号</span>
            <span class="content f_r"><em class="default"><?php echo $userinfo['user_tel']; ?></em><i class="ico"></i></span>
        </li>
        <li>
        	<span class="title f_l">主体</span>
            <span class="name"><input value="<?php echo $userinfo['user_name']; ?>"><i class="ico"></i></span>
        </li>
    </ul>
</div>
<script src="<?php echo $viewmulu;?>js/jquery.core.image.upload.min.js"></script>
<script type="text/javascript">
    $(document).ready(function () {
        var uid = "<?php echo $userinfo['user_id'];?>";
        $(".avatar_pic").coreImageUpload({
            url: baseurl + 'index.php/upload/upload_avatar?uid=' + uid+'&name='+uid+"_avatar",
            inputOfFile: 'avatar_pic',
            uploadedCallback: function (result) {
                if (result.status == 1) {
                    var img = '<img src="' + result.url + '">';
                    $(".avatar_pic_box").html(img);
                    layer.msg("头像上传成功");
                } else {
                    layer.msg(result.msg, {offset: "80px"});
                }
            }
        });
    });
    $("#user_uname").blur(function(){
        var user_uname = $("#user_uname").val();
        $.ajax({
            type : "post",
            url: baseurl+"index.php/user/sav_user",
            data: {'user_uname':user_uname},
            dataType:"JSON",
            success: function (msg) {
                if(msg.status==2){
                    layer.msg(msg.info);
                    window.location.href=baseurl+"index.php/login";
                }
            }
        })
    });
</script>
<!--]] info -->
</body>
</html>
